home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 1 / Precision Software Applications Silver Collection Volume One (PSM) (1993).iso / windows / games / tif2win.exe / TIF2BIT.DOC < prev    next >
Text File  |  1990-02-14  |  15KB  |  352 lines

  1.  
  2.            TIF2BIT V2.2 TIFF -to- Lotus .BIT/RLE File Translator
  3.                     Copyright 1988-90 William J. Hinkle
  4.                                 14 Feb 1990
  5.  
  6.                             === User's Guide === 
  7.  
  8. The TIF2BIT program  was created to allow graphics files created as TIFF
  9. (Tagged Image Format Files) to be used in Lotus Manuscript documents.  To do
  10. this, the program translates the TIFF file into either a BIT or RLE bit-mapped
  11. raster graphics file.  Manuscript considers these file types interchangeable;
  12. often RLE files are smaller but take longer to translate with TIF2BIT and
  13. longer to load with Manuscript.  This utility was created because Lotus
  14. Manuscript R1 did not support TIFF files.  Manuscript R2 still does not
  15. support grayscale TIFF files, which TIF2BIT does.  By creating BIT or RLE
  16. files, Manuscript (and any other program that handles these files) thinks the
  17. file was created by a scanner and is perfectly happy to integrate the picture.
  18.  
  19. The BIT2WP program is included to allow you to make the resultant BIT files
  20. (or any other BIT file) into other bitmapped file formats, including TIFF.
  21. This can be useful for other DeskTop Publishing applications, where TIF2BIT
  22. is used to dither a grayscale TIFF, and BIT2WP is used to make it back into
  23. a new, monochrome, TIFF (or other format).  Output formats available are:
  24. WPG (Word Perfect 5), TIFF (Intel flavor), BIT/RLE (Lotus Manuscript),
  25. IMG (GEM), GIF (CompuServe), PCX (ZSoft/PC Paintbrush).
  26.  
  27. The two programs are: TIF2BIT.EXE, BIT2WP.EXE.
  28.  
  29. THE CATCH
  30. =========
  31. Note that these programs are released by the author, and are NOT supported
  32. by any other.  They are NOT public domain!
  33.  
  34. In fact, if you use these utilities extensively, the author will be glad to
  35. accept your registration fee of $10.00 to offset costs of developing this
  36. program.  If you use TIF2BIT or BIT2WP in a commercial or business
  37. environment, please consider this imperative.
  38.  
  39. Please see the very end of this document for details!
  40.  
  41. If you have received these utilities as part of the MetaScan bitmap-to-vector
  42. conversion package, your TIF2BIT registration fee is included in the MetaScan
  43. purchase.
  44.  
  45.  
  46.  
  47. RESTRICTIONS
  48. ============
  49.  
  50. Sorry! TIF2BIT V2.2 can handle only a subset of TIFF files!
  51. TIFF monochrome grayscale and line-type images only -- but these are
  52. the most common by far.  In fact, I've never SEEN a TIFF files with the
  53. characteristics noted below.  If you've got one, send it to me!
  54.  
  55. Not yet handled are TIFF files with these characteristics:
  56.  
  57.     RGB color files or Palette color files
  58.     --------------------------------------
  59.     An error occurs if TIF2BIT finds a TIFF color file.
  60.  
  61.     Files using CCITT FAX or LZW Compression Schemes
  62.     ------------------------------------------------
  63.     A error occurs if such a file is encountered.
  64.  
  65.     Files with Orientation other than 1st row=top, 1st column=left
  66.     --------------------------------------------------------------
  67.     An informative warning will be issued, and the image will be out of
  68.     kilter (but otherwise correct).
  69.  
  70.  
  71.  
  72. OPERATION
  73. =========
  74. First create a TIFF file that contains the graphics image you want
  75. to integrate into your document.  You can create these directly from many
  76. scanner and paint programs.  Use the standard .TIF file extension (i.e.,
  77. fname.TIF).
  78.  
  79. To create a .BIT file, type in:
  80.  
  81. TIF2BIT fname
  82. or
  83. TIF2BIT fname.TIF
  84. or
  85. TIF2BIT fname.TIF fname.BIT
  86.  
  87. from the DOS command prompt.  The .TIF extension is assumed if you do not
  88. specify one.  The .BIT extension is assumed if you don't specify one.
  89. The .BIT file name is made the same as the .TIF if not otherwise specified.
  90. Full DOS pathnames can be specified.
  91.  
  92. The .TIF file will be translated to a .BIT file.
  93. The .TIF file will not be erased.  You can also specify scaling factors, but
  94. the defaults often work the best (see below).
  95.  
  96.  
  97.  
  98. To create an .RLE file, type in:
  99.  
  100. TIF2BIT fname /r
  101. or
  102. TIF2BIT fname.TIF /r
  103. or
  104. TIF2BIT fname.TIF fname.RLE
  105.  
  106. from the DOS command prompt.  The .TIF extension is assumed if you do not
  107. specify and extension.  You can specify the .RLE extension; otherwise the
  108. .RLE extension is assumed when the /r option is used.  The .RLE file name
  109. is made the same as the .TIF if not otherwise specified.  Full DOS pathnames
  110. can be specified.
  111.  
  112. The .TIF file will be translated to an .RLE file.
  113. The .TIF file will not be erased.  You can also specify scaling factors, but
  114. the defaults often work the best (see below).
  115.  
  116. You can specify a directory, ending with \, or a drive, ending in :, as the
  117. second filename.  The output file (BIT or RLE) will be put on that path with
  118. the input filename and the appropriate extension.
  119.  
  120.  
  121.  
  122. COMPLEAT USAGE
  123. ==============
  124. If you invoke TIF2BIT from DOS without any other parameters, it will
  125. display the following help message.  This shows some of the other command
  126. line options.
  127.  
  128. -----
  129. TIF-to-BIT Translator: V2.2 ... Copyright 1988-90 by W.J.Hinkle
  130.  
  131. Usage: TIF2BIT fname1 [fname2] [option] [option]
  132. where: fname1.TIF ... TIFF format input file
  133.        fname2.BIT ... Bitmapped BIT output file (default is fname1.BIT)
  134.    or  fname2.RLE ... Bitmapped RLE output file (default is fname1.RLE)
  135.  
  136. Command Line Options:
  137.        /v         ... reverse video
  138.        /iN        ... select sub-image N (default is 1)
  139.  
  140.        /cN        ... change contrast by N%
  141.        /p         ... print pixel histogram data
  142.  
  143.        /eN        ... error diffused dither, expanding xN (default is 1)
  144.        /dN        ... force dither block to NxN (<=0 =error diffused)
  145.        /hN        ... force halftone block to NxN
  146.  
  147.        /xN        ... x density = N pixels-per-inch
  148.        /yN        ... y density = N lines-per-inch
  149.        /fr        ... format RLE file output
  150.  
  151. TIF2BIT is a translator from Microsoft/Aldus TIFF files
  152. to bitmapped BIT files (default) or RLE files (using /fr).
  153. These are Lotus Manuscript image file formats.
  154. Grayscale files are dither with error diffusion, by default.
  155. You can choose pattern halftone with /hN, N=1,2,3 or 4, or
  156. patterned dither with /dN, N=1,2,4 or 8.  Use /p to get a pixel histogram.
  157. The X and Y density is taken from the TIFF file and adjusted for the
  158. halftone block size (if used) unless set by /xN or /yN.
  159. This version handles only monochrome & grayscale TIFF files.
  160.  
  161. (followed by my shareware info...)
  162. -----
  163. If your TIFF file contains multiple sub-iamges, you can specify which one
  164. to extract and translate by specifying the /iN option, where N is the sub-
  165. image number 1,2,3... etc.  Normally, you can ignore this option; the 1st
  166. (or only!) image will be translated.  If there are additional sub-images
  167. beyond the one selected, a warning is issued and they are ignored.
  168.  
  169. Normally TIF2BIT tells Manuscript that the image density is whatever the
  170. TIFF file indicates, or 200x200 pixels (or lines) per inch if not specified.
  171. This lets Manuscript compute the "natural" size of the graphics image.
  172.  
  173.  
  174.  
  175. You can specify a different density by specifying it with either the /x or /y
  176. option switches (e.g. /x300 is 300 pixels per inch wide).  You can also
  177. alter the aspect ratio by specifying both the /x and /y option switches, with
  178. different density values.  The overrides are NOT further adjusted for
  179. halftoning!
  180.  
  181. Of course, you can always scale the image in the Manuscript \picture\ command
  182. or picture marker.
  183.  
  184. Normally TIF2BIT retains the Photometric Interpretation indicated in the
  185. TIFF file.  Often what looks good on the screen looks lousy on white paper.
  186. If you want a reverse video effect, use the /v option switch.
  187.  
  188. Grayscale TIFF files can be either dither with error diffusion (the default)
  189. or pattern dithered, or pattern halftoned.  This is necessary because each
  190. point in the output image is either black or white -- not gray.  Each of
  191. these methods "smears" the picture a bit in order to fool the eye into
  192. "seeing" gray tones in the image.
  193.  
  194. Error diffusion dithering (the default) spreads the black and white pixels
  195. around in order to minimize the error in brightness at each point in the
  196. image.  In order to improve the results, the number of pixels in the image
  197. is doubled in each direction before dithering.  You can change this increase
  198. in size by specifying the multiplier in the /eN option.
  199.  
  200. For example, the default case is /e2.  You can triple the image size before
  201. dithering by specifying /e3.  You can use the original image size by
  202. specifying /e1.  Usually the results get better as you increase this dither
  203. size factor.  Sadly, the file size of the output file gets much bigger!
  204.  
  205. Pattern dither uses a fixed grid to determine which pixels will be black and
  206. which will be white in order to simulate gray tones.  This keeps the file
  207. size down but usually results in very grainy images.  The size of the dither
  208. grid, or block, is specified by /dN, where N is 1, 2, 4 or 8, and an NxN
  209. grid is used.
  210.  
  211. Halftoning maps each gray pixel into a grid of black/white pixels with a
  212. corresponding optical density.  You specify this grid, or block, with the
  213. /hN option.  N is 1, 2, 3 or 4; an NxN grid is used.  Note that sometimes
  214. halftoning with a smaller grid than 4x4 will provide a better image.
  215.  
  216. You can also expand a black-and-white TIFF image by 2, 3 or 4 times in each
  217. dimension, using the /hN option.  The /dN and /eN options WILL NOT do this!
  218.  
  219. Experiment!
  220.  
  221. If halftoning is used, the BIT file image density is adjusted for the size of
  222. the halftone matrix.  In other words, Manuscript always sees the "natural"
  223. size of the original image, even after halftoning.
  224.  
  225.  
  226.  
  227. If a gray response curve is included in the TIFF file, it will be used during
  228. halftoning or dithering to properly adjust the optical density of the image.
  229. The contrast will be set to use the total gray response of the image.  In some
  230. cases you may have to adjust it back down with the /cN option.
  231.  
  232. The /cN option can be specified to crudely adjust the contrast of the image
  233. before halftoning or dithering.  The effect is to multiply each raw pixel
  234. value by N% (after adjustment by the grayscale response curve, if any).  The
  235. factor N can be greater or less than 100.  If not specified, a contrast is
  236. selected to spread the range of image pixel values over the entire range of 
  237. halftone or dither values.
  238.  
  239. The /p option causes a histogram to be kept on the distribution of raw pixel
  240. values in a grayscale TIFF file (before contrast and grayscale response curve
  241. adjustments).  The number of occurences of each pixel value are printed on
  242. the screen when the translation is complete.
  243.  
  244. EXAMPLES
  245. ========
  246. 1) Suppose you have a line-art TIFF file called "yikes.tif".  You can translate
  247. this to a BIT file by typing (at the DOS prompt):
  248.  
  249. TIF2BIT yikes
  250.  
  251. and you will see something like:
  252. -----
  253. TIF-to-BIT Translator: V2.2 ... Copyright 1988-90 by W.J.Hinkle
  254.  
  255. From TIFF 640x250x1 file: yikes.tif
  256.   to BIT/RLE 640x250 file: yikes.bit
  257.   "Natural" picture size is 9.014W x 6.410H inches.
  258. -----
  259.  
  260. Note that both the TIFF file resolution (and grayscale depth, here 1 bit),
  261. and the BIT file resolution, are shown.  Also shown are the "natural" size
  262. of the final image, and the file names.
  263.  
  264.  
  265.  
  266. 2) Suppose you have a grayscale TIFF file called "pebble75.tif".  You can
  267. translate this to a BIT file by typing (at the DOS prompt):
  268.  
  269. TIF2BIT pebble75
  270.  
  271. and you will see something like:
  272. -----
  273. TIF-to-BIT Translator: V2.2 ... Copyright 1988-90 by W.J.Hinkle
  274.  
  275. From TIFF 156x131x4 file: pebble75.tif
  276.   to BIT/RLE 312x232 file: pebble75.bit
  277.   halftoned error diffused with 125% contrast.
  278. "Natural" picture size is 2.080W x 1.746H inches.
  279. -----
  280. Here the TIFF file grayscale depth is 4 bits.  Note that the BIT file
  281. resolution is multiplied by two in each dimension.  Note also that the
  282. contrast was automatically increased, as indicated by the TIFF file's gray
  283. response curve.
  284.  
  285.  
  286. CAVEAT
  287. ======
  288. Should you have any difficulties using this program, I'll try to help.
  289. You can try leaving Compuserve EMAIL to Bill Hinkle at [71121,3211].  General
  290. feedback is welcome, especially on better methods of grayscale halftoning
  291. and dithering.
  292.  
  293. Thanks to Jeff Lewis [72717,1033] for ideas on halftoning and dithering.
  294.  
  295.  
  296.  
  297. REVISION INFO
  298. =============
  299. *    Version number    Date        Explanation                                *
  300. *    --------------    ------        --------------------------                *
  301. *        1.0            15 Mar 88    original release                        *
  302. *        1.1            18 Mar 88    Added 32768 (short strip offsets) tag    *
  303. *                                 and fixed 32773 (PackBits) compression    *
  304. *                                 and fixed YResolution default problem    *
  305. *                                 and SamplesPerPixel tag problem        *
  306. *                                 and added pseudo-grayscale handling    *
  307. *        1.2            19 Mar 88    Added grayscale handling                *
  308. *        1.3            15 Apr 88    Added both dithering & halftoning,        *
  309. *                                 modified the halftone matrix,            *
  310. *                                 removed margin, added contrast            *
  311. *                                 adjustment, added pixel histogram        *
  312. *        1.4            20 Apr 88    Added support for Motorola TIFF files    *
  313. *        1.5            21 Apr 88    Added support for type 2 compression,    *
  314. *                                 sub-image extraction.                    *
  315. *        1.6            27 Apr 88    Cleaned up incorrect help messages,        *
  316. *                                added output file directory support    *
  317. *        1.7            05 May 88    Change intensity level selection and     *
  318. *                                 altered dither & halftone levels        *
  319. *        1.8            07 Jun 88    Speeded up dithering & halftoning        *
  320. *        2.0            08 Dec 88    Added error-diffused dithering            *
  321. *                                 and .RLE extension recognition            *
  322. *                                 and some tweeks for TIFF V5            *
  323. *        2.1            02 Dec 89    Fixed obscure problem with Mac format    *
  324. *                                 TIFFs (some grayscales and stripped)    *
  325. *        2.2            09 Feb 90    Changed help message, added /eN error    *
  326. *                                 diffusion flag instead of /d-N.  Allow *
  327. *                                 multiplication of size for 1-bit TIFFs *
  328. *                                 using the /hn parameter.                *
  329.  
  330. COPYRIGHT INFO
  331. ==============
  332. These programs TIF2BIT.EXE, BIT2WP.EXE were written by
  333.  
  334.     William J. Hinkle
  335.  
  336. who retains the copyright.  Copy and use them freely.  Distribute them
  337. to whomever you want.  But:
  338.  
  339. === Do not distribute modified versions.
  340. === Do not remove the copyright notice.
  341. === Always distribute these programs together, and with the documentation.
  342.  
  343. If you feel that these programs have been of some utility, please register
  344. by sending your registration fee of $10.00.  If you are using these programs
  345. in a commercial environment, please consider this mandatory.  You will
  346. receive a written receipt.  Thank you!
  347.  
  348. William J. Hinkle [71121,3211]
  349.  
  350. 420 E.Boston Mills Rd.
  351. Hudson, OH 44236-1111
  352.